Skip to content

feat(server): per-deployment public URL + deep-link builder (RIG-2717 T5) - #639

Merged
mattwilkinsonn merged 6 commits into
mainfrom
compass-server/rig-2717-server
Aug 27, 2026
Merged

feat(server): per-deployment public URL + deep-link builder (RIG-2717 T5)#639
mattwilkinsonn merged 6 commits into
mainfrom
compass-server/rig-2717-server

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 2 PRs:

  1. main
  2. feat(linearagent): Linear Agent Session webhook types + API client (RIG-2717 T1/T2) #638
  3. "feat(server): per-deployment public URL + deep-link builder (RIG-2717 T5)" (this PR)

Add ServeConfig.PublicURL and the deep-link builder for the Linear Agent Session responder.

  • PublicURL comes from --public-url / $COMPASS_PUBLIC_URL (flag → env, no default) per Matt's ruling on this PR: the managed-service host is a deployment concern that never lives in this repo, so an unset value stays empty rather than baking in compass.rigel.build.
  • deepLinkFor(base, channelID) builds the "Open in Compass" deep link to a Manager's home channel (the UI hash route). An empty base yields a relative fragment for a socket-only local deploy.
  • requirePublicURL is the legible boot guard: a deployment that consumes Linear webhooks needs a real public URL, so an empty value fails closed at boot with a clear message rather than emitting broken deep links.
  • Threaded through cmd/compass-server (the server entrypoint) — not cmd/compass (the operator CLI, which does no server construction).

Spec-impact: none. Refs RIG-2717
Co-authored-by: Matt Wilkinson matt@rigel.build

@linear-code

linear-code Bot commented Aug 26, 2026

Copy link
Copy Markdown

RIG-2717

@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-server-rig-2717-serv.compass-eng-docs.pages.dev

Deployed from compass-server/rig-2717-server at 15a85c6.

rigel-mintaka and others added 5 commits August 27, 2026 14:03
…IG-2717 T1/T2)

New go/internal/linearagent package for the Linear Agent Session responder:

- webhook.go (T1): SessionEvent envelope (AgentSessionEventWebhookPayload
  shape), ParseSessionEvent, VerifySignature (constant-time HMAC-SHA256 over
  the raw body, false on hex-decode error), CheckTimestamp (bidirectional
  skew on the ms-epoch webhookTimestamp).
- client.go (T2): client-credentials TokenSource (in-memory cache,
  singleflight-coalesced re-mint, pinned scope), and the Client emitter
  wrapping agentActivityCreate (the thought ack) + agentSessionUpdate (the
  external-URL deep link), re-minting once and retrying once on 401.

Pure/unit-tested against httptest; no HTTP handler, store, or dispatcher yet
(sibling tasks). Builds against the frozen record
docs/designs/product/compass-linear-agent-responder/design.md.

Ref: RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
…717 T3/T3a)

Persistence for the Linear Agent Session responder:

- T3: new 0002_linear_agent_sessions migration (association row keyed on the
  Linear session id; no dedup column — dedup is the comms rail's
  client_request_id), UpsertLinearAgentSession (ON CONFLICT DO NOTHING,
  created=false on replay) + LinearAgentSession lookup, and
  AuthoredArtifactByCoordinate (by-coordinate ownership read the router needs).
- T3a: generalize the reserved system-account seed to a shared
  ensureSystemSubtypeAccount, add EnsureLinearBridgeAccount seeding @linear as
  a second system-subtype account, and reserve the 'linear' handle against
  user/agent registration.

pgtest-covered (upsert/replay/lookup, by-coordinate hit/miss, @linear
idempotent seed + structural exclusions + reserved-handle guard).

Ref: RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
…ration (RIG-2717)

Matt's ruling on #638: collapse the linear_agent_sessions table into the single existing 0001_init.sql migration rather than shipping an incremental 0002 — Compass isn't deployed yet, so there's no data to migrate and no reason for a versioned increment.

Moves the CREATE TABLE linear_agent_sessions into 0001_init.sql (adapting the file-header comment), deletes 0002_linear_agent_sessions.sql, and updates the pgtest header comment that named the '0002 table'. Pure DDL relocation — no backfill (the table carried none), no schema shape change; the migration loader embeds migrations/*.sql and enforces a contiguous 1..N sequence, so a single 0001 stays valid.

Refs RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
… T5)

Add ServeConfig.PublicURL (--public-url flag / $COMPASS_PUBLIC_URL,
flag->env->default https://compass.rigel.build), and deepLinkFor(base,
channelID) building the 'Open in Compass' deep link to a Manager's home
channel (the UI hash route), with requirePublicURL as the legible boot guard
for a Linear-webhook-consuming deploy. Threaded through cmd/compass-server
(the server entrypoint) — not cmd/compass (the operator CLI, which does no
server construction).

Ref: RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
…ern (RIG-2717)

Matt's ruling on #639: don't default --public-url to the managed-service host (https://compass.rigel.build). That host is where the managed deployment lives, which never lives in this repo; baking it as the fallback means a self-host/dev deploy that forgets the flag silently emits deep links to the managed host.

Removes the defaultPublicURL constant; PublicURL now resolves from --public-url then $COMPASS_PUBLIC_URL with no default (empty when unset). The existing requirePublicURL boot guard already rejects an empty base for a webhook-consuming deploy and yields relative fragments for socket-only local — so no-default is the right shape (a dummy non-empty URL would instead DEFEAT that guard). Updates the flag help + the ServeConfig/boot-log/boot-guard doc comments, and neutralizes the managed host out of deeplink_test.go's sample URLs.

Refs RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-2717-store branch from dd0e7e7 to 9e905be Compare August 27, 2026 18:06
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-2717-server branch from 64d1e31 to e7b14d4 Compare August 27, 2026 18:09
…y doc (RIG-2717)

Review finding (#639, low): after removing the managed default, firstNonEmpty's doc comment still described a 'where a managed default follows, flag-then-env-then-default' precedence that no remaining caller uses (every caller is flag-then-env only) — muddying the very ruling this branch implements. Simplified to describe only the flag-then-env precedence in use. Comment-only.

Refs RIG-2717
Co-authored-by: Matt Wilkinson <matt@rigel.build>
Base automatically changed from compass-server/rig-2717-store to main August 27, 2026 21:24
@mattwilkinsonn
mattwilkinsonn merged commit 5d01d87 into main Aug 27, 2026
25 checks passed
@mattwilkinsonn
mattwilkinsonn deleted the compass-server/rig-2717-server branch August 27, 2026 21:24
mattwilkinsonn added a commit that referenced this pull request Aug 27, 2026
…692)

* test(forge): fix matrixChecksRoller to current ChecksRoller signature (RIG-2848)

The RIG-2848 notification-matrix test double still returned the removed ingest.ChecksResult placeholder, which RIG-2732 (#677) collapsed into the real forge.ConditionalResult[forge.Checks] when it landed the conditional-read seam. The two PRs merged in an order that left main red — compass-go:vet/test fail-closed on `undefined: ingest.ChecksResult` in server/forge_notify_matrix_test.go, blocking every compass PR at the pre-push gate.

Update matrixChecksRoller's field and RollUp return to forge.ConditionalResult[forge.Checks] (the forge import already present), matching the ChecksRoller interface. Mechanical adapter fix; the signature dictates the exact change.

Spec-impact: none. Refs RIG-2848

Co-authored-by: Matt Wilkinson <matt@rigel.build>

* docs(server): drop redundant public-URL rationale comment (RIG-2717)

Remove the floating comment above errUsage that editorialized the no-default public-URL decision with deployment/business framing ("the managed-service host is a deployment concern that never lives in this repo"). It attaches to no declaration and every behavioral fact it stated is already documented at its proper home: the --public-url flag help (no default, must be set), requirePublicURL / errNoPublicURL (empty rejected at boot for a Linear-webhook deploy), and deepLinkFor (empty base yields a relative fragment). The rationale prose reads as out-of-place editorializing in the OSS product's source. Follow-up to #639 (merged at its pre-fix head).

Spec-impact: none. Refs RIG-2717

Co-authored-by: Matt Wilkinson <matt@rigel.build>

---------

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants